{% extends "_layout.html" %}
{% import "component/pagination.njk" as pagination %}
{% import "component/table.njk" as table %}
{% import "component/search.njk" as search %}

{# 样式代码 #}
{% block style %}

{% endblock %}

{# bodyd代码#}
{% block body %}
<div class="wrapper wrapper-content">
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">

            <div class="ibox-content">
                <div class="row">
                    <div class="col-sm-12">
                        <form class="page-search-form">
                            {{ search.select('是否可预约', 'isPreShow', [{
                            id: '1',
                            name: '是'
                            },{
                            id: '0',
                            name: '否'
                            }], params.isPreShow) }}

                            {{ search.select('是否推荐', 'isRecommend', [{
                            id: '1',
                            name: '是'
                            },{
                            id: '0',
                            name: '否'
                            }], params.isRecommend) }}

                            <div class="col-sm-3">
                                <div class="input-group">
                                    <span class="input-group-addon">菜品分类</span>
                                    <select class="form-control m-b" name="goodsTypeId">
                                        <option value="">全部</option>
                                        {% for item in goodsType %}
                                        <option value="{{ item.value }}" {{ 'selected' if item.value == params.goodsTypeId else ''}}>{{ item.text }}</option>
                                        {% endfor %}
                                    </select>
                                </div>
                            </div>

                            {{ search.text('名称', 'name', params.name, true) }}
                        </form>
                    </div>
                    <div class="col-sm-2">
                        <div class="ibox-tools">
                            <a href="/goods/edit" class="btn btn-primary btn-xm">添加商品</a>
                        </div>
                    </div>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="table-responsive">
                   <form id="table-form">
                       <table class="table table-striped">
                           <thead>
                           <tr>
                               <th></th>
                               <th>图片</th>
                               <th>菜品名称</th>
                               <th>菜品类型</th>
                               <th>菜品价格</th>
                               <th>是否推荐</th>
                               <th>是否可预约</th>
                               <th>添加时间</th>
                               <th>操作</th>
                           </tr>
                           </thead>
                           <tbody>
                           {% for item in data.list %}
                               <tr>
                                   <td>
                                       <input type="checkbox" value="{{ item.id }}" class="i-checks" name="check">
                                   </td>
                                   <td class="image">
                                       <a href="/goods/edit?id={{ item.id }}"><img alt="image" class="image" src="{{ ctx.helper.showImage(item.image, 50, 50, 'fixed') }}"></a>
                                   </td>
                                   <td width="260">{{ item.name }}</td>
                                   <td>{{ item.goodsType.name }}</td>
                                   <td>￥{{ item.price }}</td>
                                   <td>
                                       {% if item.isRecommend %}
                                       <span style="color: red;">是</span><a class="ajax" data-href="/goods/recommend/cancel?id={{item.id}}">[关闭]</a>
                                       {% else%}
                                       <span style="color: green;">否</span><a href="/goods/recommend?id={{item.id}}">[开启]</a>
                                       {% endif %}
                                   </td>
                                   <td>
                                       {% if item.isPreShow %}
                                       <span style="color: red;">是</span><a class="ajax" data-href="/goods/pre/cancel?id={{item.id}}">[关闭]</a>
                                       {% else%}
                                       <span style="color: green;">否</span><a href="/goods/pre?id={{item.id}}">[开启]</a>
                                       {% endif %}
                                   </td>
                                   <td>{{ item.createTime }}</td>
                                   <td data-id="{{ item.id }}">
                                       {% if item.type == 2 %}
                                       <a href="/goods/group?id={{item.id}}">套餐编辑</a>
                                       {% endif %}
                                       <a href="/goods/edit?id={{item.id}}">编辑</a>
                                       <a href="/goods/edit/en?id={{item.id}}">英文信息</a>
                                       <a class="del" data-id="{{ item.id }}" data-href="/goods/delete">删除</a>
                                   </td>
                               </tr>
                           {% else %}
                               暂无数据
                           {% endfor %}
                           </tbody>
                       </table>
                   </form>
                </div>
                <div class="hr-line-dashed"></div>
                <div class="btn-region clearfix">
                    <div class="pull-left">
                        <button href="" id="batch-del-btn" class="btn btn-danger btn-sm js-batch" data-url="/goods/delete" data-confirm="确定删除选中的桌台吗?" data-original-title="" title="">批量删除</button>
                    </div>
                    <div class="pull-right">
                        {{ pagination.pagination(data, params, '/goods') }}
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>
</div>
{% endblock %}

{#js代码#}
{% block js %}
<script>


</script>

{% endblock %}
